import com.sun.xml.internal.ws.addressing.WsaActionUtil;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description
 * User: wen
 * Date:2022-02-13
 * TIME:17:22
 */

public class TestDemo {
    public static void main(String[] args) {
        
    }
    public static void main24(String[] args) {
        //
        int i = 1;
        while(i <=100){
            if(i % 15 != 0){
                i++;
                //continue;
            }
            else{
                System.out.println(i);
                i++;
            }
        }
    }
    public static void main23(String[] args) {
        int num = 1;
        while(num <= 100){

            if(num % 3 == 0 && num % 5 ==0){
                System.out.println(num);
                continue;
            }
            else {
                num++;
            }
        }
    }
    public static void main22(String[] args) {
        /**
         * break和continue必须在循环中使用【break可以在switch中使用】
         * 1个break只能跳出一层循环
         */
    }
    ////找到10以内所有3的倍数
    public static void main21(String[] args) {
        int i = 1;
        while (i <= 10){
            if(i % 3 != 0){
                i++;
                continue;
            }
            else{
                System.out.println(i);
                i++;
            }
        }
    }
    //找到10以内第一个3的倍数
    public static void main20(String[] args) {
        int i = 1;
        while(i < 10){
            if(i % 3 == 0){
                System.out.println(i);
                break;
            }
            i++;
        }
    }
    public static void main19(String[] args) {
        int num = 1;
        int sum = 0;
        // 外层循环负责求阶乘的和
        while (num <= 5) {
            int factorResult = 1;
            int tmp = 1;
            // 里层循环负责完成求阶乘的细节.
            while (tmp <= num) {
                factorResult *= tmp;
                tmp++;
            }
            sum += factorResult;
            num++;
        }
        System.out.println("sum = " + sum);
    }
    public static void main18(String[] args) {
        int n = 1;
        int result = 1;
        int sum = 0;
        int tmp = 1;
        while(tmp<=5){
            while(n<=tmp){
                result = result * n;
                n++;
            }
            sum = result + sum;
            tmp++;
        }
        System.out.println(sum);
    }
    public static void main17(String[] args) {
        int n = 1;
        int result = 1;
        while(n<=5){
            result = result * n;
            n++;
        }
        System.out.println(result);
    }
    public static void main16(String[] args) {
        //代码示例3: 计算 5 的阶乘
        int fac = 1;
        int i = 5;
        while(i >= 1){

            fac = fac * i;
            i--;
        }
        System.out.println(fac);
    }
    public static void main15(String[] args) {
        // 计算 1 - 100 的和
        int i = 1;
        int sum = 0;
        while(i<=100){
            i++;
            sum = sum + i;
        }
        System.out.println(sum);
    }
    public static void main14(String[] args) {

        //代码示例1: 打印 1 - 10 的数字
        int i = 1;
        while(i<=10){
            System.out.println(i);
            i++;
        }

    }
    public static void main13(String[] args) {
        int i = 0;
        int sum = 0;
        while(i <= 5){
            sum = sum + i;
            i++;
        }
        System.out.println(sum);
    }
    public static void main12(String[] args) {
        //long a = 1L;
        //
        //
        //
        //
        //


    }
    public static void main11(String[] args) {
        //String a = "abcd";
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        switch(str){
            case "abcd":
                System.out.println("1");
                break;
            case "efgh":
                System.out.println("2");
                break;
            default:
                System.out.println("参数错误");
                break;
        }
    }
    public static void main10(String[] args) {
        //Java中，不能当作switch参数的数据类型有哪些？
        //1.long float double boolean
        //2.JDK 1.5开始 引入枚举：枚举也可以作为switch参数
        //switch 中的值只能是 整数|枚举|字符|字符串
        int a = 0;
        switch(a){
            case 1:
                System.out.println("1");
                break;
            case 0:
                System.out.println("2");
                break;
            default:
                System.out.println("参数错误");
                break;
        }
    }
    public static void main9(String[] args) {
        int x = 20;
        if (x == 10); {
            System.out.println("hehe");
        }
    }
    public static void main8(String[] args) {
        int x = 10;
        int y = 10;
        if (x == 10)
            if (y == 10)
                System.out.println("aaa");
            else
                System.out.println("bbb");
    }
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int year = scanner.nextInt();
        if((year % 100 != 0 && year % 4 == 0) || (year % 400 ==0)){
            System.out.println("闰年");
        }
        else{
            System.out.println("不是闰年");
        }
    }
    public static void main6(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        String str = scanner.nextLine();
        System.out.println(str);

        if(n%2 == 0){
            System.out.println("偶数");
        }
        else{
            System.out.println("奇数");
        }
    }
    public static void main5(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        System.out.println(str);
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if(n%2 == 0){
            System.out.println("偶数");
        }
        else{
            System.out.println("奇数");
        }
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //alt+回车
        int n = scanner.nextInt();
        //
        String str = scanner.nextLine();
        //String str1 = scanner.next();
        System.out.println(str);
        //System.out.println(str1);
        if(n%2==0){
            System.out.println("偶数");
        }
        else{
            System.out.println("奇数");
        }
    }
    public static void main2(String[] args) {
        /*
                //1.
        if(布尔表达式){
            //
        }
        //2.
        if(布尔表达式){
            //条件满足时执行代码
        }else{
            //条件不满足时执行代码
        }
        //3.
        if(布尔表达式){
            //条件满足时执行代码
        }else if(布尔表达式){
            //条件满足时执行代码
        }else{
            //条件都不满足时执行代码
        }

         */

    }
    public static void main1(String[] args) {
        System.out.println("1");
        System.out.println("2");
        System.out.println("3");
        System.out.println("4");
    }
}
